export const getVariable = (runtime, name, filepath) => {
  const scope = runtime.scopes.get(filepath)

  const constant = scope.get('constant')
  const variable = scope.get('variable')

  if (constant.has(name)) return constant.get(name)
  if (variable.has(name)) return variable.get(name)

  if (runtime.parent !== null) return getVariable(runtime.parent, name, filepath)
  return null
}